// vue应用
import { createApp, ref } from 'vue'
import App from './App.vue'

// vue路由
import router from './router'

// elementUI组件包
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/theme-chalk/dark/css-vars.css'

// pinia
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// 创建应用
const app = createApp(App)

// 注册路由和组件
app.use(router)
app.use(ElementPlus)

// 注册elementUI的icon
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 创建pinia
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(pinia)

// 启动应用
app.mount('#app')
